package com.weiyuwqj.server.task;


import com.weiyuwqj.api.model.BasItem;
import com.weiyuwqj.api.model.BusItemAuto;
import com.weiyuwqj.api.service.BusAutoInvestService;
import com.weiyuwqj.server.auto.BusItemAutoInvest;
import com.weiyuwqj.server.mapper.BasItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * Created by zhangyong on 2017/4/7.
 */
@Component
public class DayAutoInvestTask {

    @Autowired
    BasItemMapper itemMapper;
    @Autowired
    BusItemAutoInvest autoInvest;

//    @Scheduled(cron="0/30 * * * * ?")
//    public void autoInvest(){
//        List<BasItem> itemList=itemMapper.getItemCountdownList();
//        for(BasItem item:itemList){
//            Date date=new Date();
//            long a=0L;
//            if(item.getReleaseTime()!=null){
//                a=item.getReleaseTime().getTime();
//            }
//            long b=date.getTime();
//            long d=a-b;
//            if(d<=60*1000){
//                //自动投标
//                autoInvest.busItemMatchingAutoRule(item);
//            }
//        }
//    }
}
